home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / MakeLib < prev    next >
Text File  |  1992-07-24  |  2KB  |  92 lines

  1. #! /bin/sh
  2. ##  $Revision: 1.3 $
  3. ##  Script to build an easy-to-ship single directory that contains
  4. ##  everything needed to build NNTP clientlib emulation on a machine.
  5.  
  6. ##  Optional first argument is the destination architecture, like "sun4"
  7. DIR=nntplib.${1-dist}
  8. if [ -d ${DIR} ] ; then
  9.     echo ${DIR} exists!
  10.     exit 1
  11. fi
  12. mkdir ${DIR}
  13.  
  14. ##  Copy the files.
  15. for I in \
  16.     config/subst.c config/subst.sh config/config.data \
  17.     doc/inn.conf.5 \
  18.     include/clibrary.h include/configdata.h include/libinn.h \
  19.     include/macros.h include/mystring.h include/mymemory.h \
  20.     include/myserver.h include/nntp.h include/paths.h \
  21.     lib/clientlib.c lib/getconfig.c lib/getfqdn.c lib/remopen.c \
  22.     site/inn.conf ; do \
  23.     cp $I ${DIR}
  24. done
  25.  
  26. ##  Write the Makefile.  We duplicate the RCS revision string of the
  27. ##  script into the Makefile on purpose.
  28. cat <<\EOF >${DIR}/Makefile
  29. ##  $Revision: 1.3 $
  30. SHELL    = /bin/sh
  31. MAKE    = make
  32.  
  33. ##  Configuration dependencies -- edit as appropriate
  34. DEFS    =
  35. CFLAGS    = $(DEFS) -g
  36. LDFLAGS    = -Bstatic
  37. LINTFLAGS=-b -h -u $(DEFS)
  38. RANLIB    = ranlib
  39.  
  40. ##  Manual pages -- install as appropriate for your system
  41. DOC    = inn.conf.5
  42.  
  43. ##  Configuration files -- install in /usr/lib/news
  44. CONF    = inn.conf
  45.  
  46. ##  Program sources
  47. SOURCES = clientlib.c getconfig.c getfqdn.c remopen.c
  48. OBJECTS = clientlib.o getconfig.o getfqdn.o remopen.o
  49. HEADERS    = clibrary.h configdata.h libinn.h macros.h nntp.h paths.h
  50.  
  51. ##  First target, just compile everything.
  52. all:            libinn.a $(DOC) $(CONF)
  53.     date >$@
  54.  
  55. install:        libinn.a
  56.     -date >$@
  57.  
  58. clobber clean:
  59.     rm -f foo core tags lint a.out *.o
  60.     rm -f libinn.a
  61.     rm -f all install
  62.  
  63. libinn.a:        $(OBJECTS)
  64.     ar r $@ $(OBJECTS)
  65.     $(RANLIB) $@
  66.  
  67. lint:            $(OBJECTS)
  68.     -lint -u $(LINTFLAGS) $(SOURCES) >lint
  69.  
  70. subst:        subst.c subst.sh
  71.     make c || make sh || { rm -f subst ; echo Failed 1>&2 ; }
  72.  
  73. config:        subst config.data $(DOC) $(HEADERS) Makefile
  74.     ./subst -f config.data $(DOC) $(HEADERS) Makefile
  75.     date >config
  76.  
  77. c:
  78.     @rm -f subst
  79.     $(CC) -o subst subst.c
  80. sh:
  81.     @rm -f subst
  82.     cp subst.sh subst
  83.     chmod +x subst
  84.  
  85. ##  Dependencies.  Default list, below, is probably good enough.
  86. depend:        Makefile $(SOURCES)
  87.     makedepend $(DEFS) $(SOURCES)
  88.  
  89. # DO NOT DELETE THIS LINE -- make depend depends on it.
  90. $(OBJECTS):    $(HEADERS)
  91. EOF
  92.